#封装
class people:
    name=""
    weight=0
    def __init__(self,name,weight,aihao:str):
        self.name = name
        self.weight=weight
        self.aihao=aihao
        print(f"我的名字叫{self.name},爱好是{self.aihao}")
    def eatFood(self):
        self.weight= self.weight+1
    def sport(self):
        self.weight -=0.5
    def showWeight(self):
        print(self.weight)
class jiaju:
    def __init__(self,name,area):
        self.name=name
        self.area=area
class House:
    jiajulist=[]
    def __init__(self,house_type,area):
        self.jiajulist1=[]
        self.house_type =house_type
        self.area =area
    def addJiaju(self,object :jiaju):
        self.jiajulist1.append(object.name)
    def __str__(self):
        return f"户型{self.house_type},面积{self.area},含有家具{self.jiajulist1}"
house1 = House("三室一厅",128)
house2 =House("liangjian",256)
jiaju1 = jiaju("沙发",6)
jiaju2 = jiaju("椅子",13)
house1.addJiaju(jiaju1)
house1.addJiaju(jiaju2)
house2.addJiaju(jiaju2)
print(house1)
print(House.jiajulist)
print(house2)
xiaoMing= people("小明", 75,"没有")
xiaoMei= people("小美", 45,"跑步")
xiaoMing.showWeight()
xiaoMei.showWeight()
xiaoMing.eatFood()
xiaoMing.eatFood()
xiaoMing.eatFood()
xiaoMing.eatFood()
xiaoMing.showWeight()
xiaoMing.sport()
xiaoMing.sport()
xiaoMing.showWeight()


#封装 继承  重构  多态
#继承  实现代码的复用
    #单继承    一个父类
    #多继承    多父类 涉及调用时，就近原则，先左后右原则
    #父类的私有方法和私有属性无法调用
#子类（派生类）：猫类
#重载：重构      实现功能的重写
#多态
    #不同的子类对象调用相同的方法，产生不同的执行结果（呈现多种形态）
class animal:

    def eat(self):
        print("******。。。。饿了")
    def speak(self):
        pass
class tiger:
    def eat(self):
        print("******.....好饿，老虎吃东西")
class cat(animal,tiger):
    pass
    # def eat(self):
    #     """重构父类方法"""
    #     print("喵喵。。。。。。。。。。。饿了")


#多态
#支付方式   微信支付    支付宝支付   银联支付 ->都需要支付收款，实现业务不同

class wx:
    def pay(self):
        print("微信支付")
    def skuan(self):
        pass
class zfb:
    def pay(self):
        print("支付宝支付")
    def skuan(self):
        pass
class yl:
    def pay(self):
        print("银联支付")
    def skuan(self):
        pass
def startPay(object):   #多态体现   根据传参对象选择对象的方法或属性
    object.pay()














